/*
* Copyright 2018 Shanxi Lu'an Taihang Laihui Net Tech co.,LTD.
*/
package com.laihuichuxing.factory.simple;/**
 * Description:
 *
 * @author: Qinxuefeng
 * @since: 1.0
 * Create Date Time: 2018/12/13 9:30
 * Update Date Time:
 */

public class OperationFactory {
    public static Operation createOperation(char operator){
        Operation operation = null;
        switch (operator){
            case '+' :
                operation = new OperationAdd();
                break;
            case '-' :
                operation = new OperationSub();
                break;
            case '*' :
                operation = new OperationMul();
                break;
            case '/' :
                operation = new OperationDiv();
                break;
            default :
                throw new RuntimeException("unsupported operation");
        }
        return operation;
    }
}
